package xyz.lovegu.server.bus.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import xyz.lovegu.server.bus.service.HealthService;
import xyz.lovegu.server.bus.vos.HealthVo;
import xyz.lovegu.server.sys.common.ResultMessage;
import xyz.lovegu.server.sys.common.ResultObj;
import xyz.lovegu.server.sys.common.ResultUtil;

/**
 * @author 老顾
 * @title: HealthController
 * @projectName campus-prevention-system
 * @email: 1437594522@qq.com
 * @date 2022/5/10 11:03
 */
@Validated
@RestController
@RequestMapping("bus/health")
@RequiredArgsConstructor
public class HealthController {

    private final HealthService healthService;

    @PostMapping("addHealth")
    public ResultMessage<ResultObj> addHealth(@RequestBody HealthVo healthVo) {
        return ResultUtil.data(healthService.addHealth(healthVo));
    }

    @PostMapping("deleteBatchHealth")
    public ResultMessage<ResultObj> deleteBatchHealth(@RequestBody HealthVo healthVo) {
        return ResultUtil.data(healthService.deleteBatchHealth(healthVo));
    }

    @GetMapping("getHealthByUserId")
    public ResultMessage<Object> getHealthByUserId(HealthVo healthVo) {
        return ResultUtil.data(healthService.getHealthByUserId(healthVo));
    }

    @GetMapping("getAllHealth")
    public ResultMessage<Object> getAllHealth(HealthVo healthVo) {
        return ResultUtil.data(healthService.getAllHealth(healthVo));
    }
}
